<%@page import="com.hnas.sys.service.system.dto.DTOUser"%>
<%@page import="com.hnas.sys.core.util.UserUtils"%>
<%@page import="java.util.Calendar"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page import="com.hnas.core.util.PropertyUtil"%>
<%@page import="com.hnas.core.dto.DataBean"%>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="keywords" content="" />
		<meta name="description" content="" />
		<title>首页-桂林国旅</title>
		<link href="${pageContext.request.contextPath }/static/common/style/basic.css" rel="stylesheet" type="text/css" />
		<link href="${pageContext.request.contextPath }/static/common/style/index.css" rel="stylesheet" type="text/css" />
		<link href="${pageContext.request.contextPath }/static/frontend/styles/banner.css" rel="stylesheet" type="text/css" />
		<link  href="${pageContext.request.contextPath  }/static/common/style/dialog.css"  rel="stylesheet" type="text/css"/>
		<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/jquery-1.10.2.min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/bootstrap-datepicker.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/jquery.timepicker.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/jquery.datepair.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/util.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath }/static/frontend/scripts/jqueryPhoto.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath }/static/frontend/scripts/jqueryBanner.js"></script>
		 <script type="text/javascript" src="${pageContext.request.contextPath }/static/common/script/jquery.dialog.js"></script>
		
		<script type="text/javascript">
			function changeImage() {
		    	$('#validateCodeImg').hide().attr('src', '${pageContext.request.contextPath }/codeImage?' + Math.floor(Math.random()*100) ).fadeIn();  
		    	event.cancelBubble=true;  
			} 
			function checkEmpty(f){
				if (f.j_username.value=='')
				{
					//alert('请输入用户名！');
					$.dialog.alert({title:"登陆",content:"请输入账号！",objCtrl:"#j_username"});
					f.j_username.focus();
					return false;
				}
				if (f.j_password.value=='')
				{
					//alert('请输入密码！');
					$.dialog.alert({title:"登陆",content:"请输入密码！",objCtrl:"#j_password"});
					f.j_password.focus();
					return false;
				}
				if (f.sms_img_code.value=='')
				{
					//alert('请输入图片验证码！');
					$.dialog.alert({title:"登陆",content:"请输入图片验证码！",objCtrl:"#sms_img_code"});
					f.sms_img_code.focus();
					return false;
				}
				return true;

			}
		</script>
		

	</head>
	<body>
		<%
			DTOUser user = null;
			String name = "";
			try{
			 	user = UserUtils.getCurrentUser();
			 	if(user!=null) {
			 		name = user.getName();
			 	}
			}catch(Exception ex){
				
			}
		%>
		<%@ include file="/inc_head.jsp" %>
		<div class="containerIndex">
			<!-- 主要内容 -->
			<div class="content">
				<div class="bannerBar m_b_36">
					<div id="banner"> 
<ul>
 <c:forEach items="${dtoAdvImages}" var="dtoAdvImage" varStatus="status">
  <li>${status.index + 1}</li>
 </c:forEach>
</ul>
<div id="banner_list">
<c:forEach items="${dtoAdvImages}" var="dtoAdvImage">
<a href="${dtoAdvImage.proUrl}" target="_blank"><img src="${pageContext.request.contextPath }/${dtoAdvImage.imageUrl}" title="" alt=""/></a>
</c:forEach>
</div>
</div>

					<% if(user==null) { %>
					<div class="loginBar">
						<form method="post" action="${pageContext.request.contextPath }/j_spring_security_check" name="loginForm" id="logingForm" onsubmit='return checkEmpty(this);' >
						<div class="p_20">
							<h3 class="tit">欢迎登录 <em class="f_18 c_ea2c2c">${sessionScope.loginfail}</em></h3>
							<p class="item"><input style="width:63%;" class="input_style1" type="text" name="j_username" id="j_username" placeholder="请输入您的账号"></p>
							<p class="item"><input style="width:63%;" class="input_style1" type="password" name="j_password" id="j_password" placeholder="请输入密码">
							<p class="item"><input style="width:30%;" class="input_style1" type="text" name="validateCode" id="sms_img_code" placeholder="获取验证码">
							<a href="javascript:void(0);" style="text-align:justify;"><img style="vertical-align:middle;" src="${pageContext.request.contextPath }/codeImage" alt="点击更换图片" onclick="changeImage();" id="validateCodeImg" width="90" /></a>
							</p>
							<p class="item"><input style="width:98%;" class="btn_red01" type="submit" value="立即登录"></p>
						</div>
						</form>
					</div>
					<%} %>
				</div>
				<div class="box_01 m_b_36">
					<div class="hd m_b_9">
						<h3 class="tit fl">
							<i class="ico ico_01"></i>
							<span class="cn">特惠产品<em></em></span>
							<span class="en">HOTSALE PRODUCT</span>
						</h3>
						<span class="fr"><a href="${pageContext.request.contextPath}/frontend/product/searchProducts">更多</a></span>
					</div>
					<div class="bg roll p_20">
						<a class="btn_l" href="javascript:void(0);" id="prev"><i></i></a>
						<a class="btn_r" href="javascript:void(0);" id="next"><i></i></a>
						<div class="roll_bg listBox" id="listBox">
							<ul class="roll_list cf" style="width:2000px;">
							  <c:forEach items="${Prefer.list}" var="preferProduct">
								<li>
									<div class="pic"><a href="${pageContext.request.contextPath}/frontend/product/show?id=${preferProduct.id}" ><img src="${pageContext.request.contextPath}/${preferProduct.picture1Url}" style="width:100%;height:100%;" /></a></div>
									<div class="info">
										<h4 class="tit"><a href="${pageContext.request.contextPath}/frontend/product/show?id=${preferProduct.id}">${preferProduct.productName}</a></h4>
										<c:forEach items="${preferProduct.priceList}" var="dtoXPrice" varStatus="status">
				                		<c:choose>
                                            <c:when test="${status.first==true}">  
				                				 <p>活动价：<em>¥${dtoXPrice.adultPrice} 起</em></p>
                                             </c:when>            
                                         </c:choose>         
                                         </c:forEach>
									</div>
								</li>
								</c:forEach>
							</ul>
						</div>
					</div>
				</div>
				
				<div class="box_01 m_b_36">
					<div class="hd bb_2bb8aa">
						<span class="fr"><a href="${pageContext.request.contextPath}/frontend/product/searchProducts">更多</a></span>
					</div>
					<div class="bg cf">
						<div class="links fl">
							<h3 class="tit02 bg_2bb8aa">
								<i class="ico ico_03"></i>
								<span class="cn">景点门票<em></em></span>
								<span class="en">TICKET</span>
							</h3>
							<div class="p_8">
								<h5>热门景点</h5>
								<ul class="link">
								 <c:forEach items="${hotPro1zones}" var="hotPro1zone">
									<li><a href="javascript:void(0);" onclick="showHotPro(4,${hotPro1zone.id},0,'hotPro1')">${hotPro1zone.zoneName}</a></li>
								</c:forEach>
								</ul>
							</div>
						</div>
						<div class="infoBg m_b_20">
							<ul class="product_list cf " id="hotPro1">
							 <c:forEach items="${hotPro1.list}" var="hotPro1Product">
								<li>
									<div class="pic"><a href="${pageContext.request.contextPath}/frontend/product/show?id=${hotPro1Product.id}"><img src="${pageContext.request.contextPath}/${hotPro1Product.picture1Url}" style="width:100%;height:100%;"/></a></div>
							
									<div class="info">
										<h4 class="tit"><a href="${pageContext.request.contextPath}/frontend/product/show?id=${hotPro1Product.id}">${hotPro1Product.productName}</a></h4>
										<c:forEach items="${hotPro1Product.priceList}" var="dtoXPrice" varStatus="status">
				                		<c:choose>
                                            <c:when test="${status.first==true}">  
				                				<p><span class="price fl"><em>¥${dtoXPrice.adultPrice}</em> 起</span></p>
                                             </c:when>         
                                         </c:choose>         
                                         </c:forEach>
										
									</div>
								</li>
								</c:forEach>
							</ul>
						</div>
					</div>
				</div>
				<div class="box_01 m_b_36">
					<div class="hd bb_a6c11c">
						<span class="fr"><a href="${pageContext.request.contextPath}/frontend/product/searchProducts">更多</a></span>
					</div>
					<div class="bg cf">
						<div class="links fl">
							<h3 class="tit02 bg_a6c11c">
								<i class="ico ico_04"></i>
								<span class="cn">旅游产品<em></em></span>
								<span class="en">PRODUCT</span>
							</h3>
							<div class="p_8">
								<h5>热门景点</h5>
								<ul class="link">
								   <c:forEach items="${hotPro2zones}" var="hotPro2zone">
									<li><a href="javascript:void(0);" onclick="showHotPro(1,${hotPro2zone.id},0,'hotPro2')">${hotPro2zone.zoneName}</a></li>
								   </c:forEach>
								</ul>
							</div>
						</div>
						<div class="infoBg m_b_20">
							<ul class="product_list cf" id="hotPro2">
								<c:forEach items="${hotPro2.list}" var="hotPro2Product">
								<li>
									<div class="pic"><a href="${pageContext.request.contextPath}/frontend/product/show?id=${hotPro2Product.id}"><img src="${pageContext.request.contextPath}/${hotPro2Product.picture1Url}" style="width:100%;height:100%;"/></a></div>
							
									<div class="info">
										<h4 class="tit"><a href="${pageContext.request.contextPath}/frontend/product/show?id=${hotPro2Product.id}">${hotPro2Product.productName}</a></h4>
										<c:forEach items="${hotPro2Product.priceList}" var="dtoXPrice" varStatus="status">
				                		<c:choose>
                                            <c:when test="${status.first==true}">  
				                				<p><span class="price fl"><em>¥${dtoXPrice.adultPrice}</em> 起</span></p>
                                             </c:when>         
                                         </c:choose>         
                                         </c:forEach>
										
									</div>
								</li>
								</c:forEach>
							</ul>
						</div>
					</div>
				</div>
				<div class="box_01 m_b_36">
					<div class="hd bb_f0354e">
						<span class="fr"><a href="${pageContext.request.contextPath}/frontend/product/searchProducts">更多</a></span>
					</div>
					<div class="bg cf">
						<div class="links fl">
							<h3 class="tit02 bg_f0354e">
								<i class="ico ico_05"></i>
								<span class="cn">直升飞机<em></em></span>
								<span class="en">TICKET</span>
							</h3>
							<div class="p_8">
								<h5>热门机型</h5>
								<ul class="link">
								   <c:forEach items="${xGoods}" var="xGood">
									<li><a href="javascript:void(0);" onclick="showHotPro(3,0,${xGood.id},'hotPro3')">${xGood.goodName}</a></li>
								   </c:forEach>
								</ul>
							</div>
						</div>
						<div class="infoBg m_b_20">
							<ul class="product_list cf" id="hotPro3">
								<c:forEach items="${hotPro3.list}" var="hotPro3Product">
								<li>
									<div class="pic"><a href="${pageContext.request.contextPath}/frontend/product/show?id=${hotPro3Product.id}"><img src="${pageContext.request.contextPath}/${hotPro3Product.picture1Url}" style="width:100%;height:100%;"/></a></div>
							
									<div class="info">
										<h4 class="tit"><a href="${pageContext.request.contextPath}/frontend/product/show?id=${hotPro3Product.id}">${hotPro3Product.productName}</a></h4>
										<c:forEach items="${hotPro3Product.priceList}" var="dtoXPrice" varStatus="status">
				                		<c:choose>
                                            <c:when test="${status.first==true}">  
				                				<p><span class="price fl"><em>¥${dtoXPrice.adultPrice}</em> 起</span></p>
                                             </c:when>         
                                         </c:choose>         
                                         </c:forEach>
										
									</div>
								</li>
								</c:forEach>
								
							</ul>
						</div>
					</div>
				</div>
			</div>
			<!-- end 主要内容 -->
		</div>
		<!-- 站点信息 -->
	<div class="footBar">
		<div class="w_1200a cf">
			<div class="logo_foot"></div>
			<div class="copy">琼ICP备21321321号 Copy<em>&copy;</em>2015  trip.airguilin.com All Right Reserved</div>
		</div>
	</div>
		<script type="text/javascript">
		<!-- end 站点信息 -->
		 $(function () {
        var imgWid = 0;
        var imgHei = 0; //变量初始化
        var big = 2; //放大倍数
        $(".pic").hover(function () {
            $(this).find("img").stop(true, true);
            var imgWid2 = 0; var imgHei2 = 0; //局部变量
            imgWid = $(this).find("img").width();
            imgHei = $(this).find("img").height();
            imgWid2 = imgWid * big;
            imgHei2 = imgHei * big;
            $(this).find("img").css({ "z-index": 2 });
            $(this).find("img").animate({ "width": imgWid2, "height": imgHei2, "margin-left": -imgWid2 / 2, "margin-top": -imgHei2 / 2 });
            
        }, 
        function () 
        {
         $(this).find("img").stop().animate(
         { "width": imgWid, "height": imgHei, "margin-left": -imgWid / 200, "margin-top": -imgHei /100, "z-index": 1 
         }); 
         });
    })
		function showHotPro(xproductType,zoneId,goodId,colId){
		 var URL = '${pageContext.request.contextPath}/getHotPro';
		 $.ajax({
			url:URL,
			data:{"xproductType":xproductType,"zoneId":zoneId,"goodId":goodId},
			type: 'POST',
			error: function(XMLHttpRequest, textStatus, errorThrown){
				
			},
			success: function(data){
				//alert(data);
				$("#"+colId).html(data);
			}
		  });
	    }
	</script>
</body>
</html>